﻿@model IEnumerable<WebSoftSeo.Models.Contact>
<div class="mar10 borall">
    <table class="formtable">
        <tbody>
            <tr>
                <th>Tên</th>
                <th>Email</th>
                <th>Subject</th>
                <th>Message</th>
                <th>Ngày</th>
                <th>Action</th>
            </tr>
            @foreach (var item in Model)
            {
                <tr>
                    <td>
                        @Html.DisplayFor(modelItem => item.Name)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Email)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Subject)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Message)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Date)
                    </td>
                    <td>
                        <a class="button red" href="/@WebSoftSeo.Models.GlobalVariables.PathFolderName/Contact/Delete?id=@item.ID" title="Xóa">
                            <div class="icon">
                                <p class="ic-delete"></p>
                            </div>
                        </a>
                    </td>
                </tr>
            }
        </tbody>
    </table>
    <script>$("tr:even").css("background-color", "#f2f2f2");</script>
</div>
<div class="clear"></div>
<div class="mar10">
    @using (Ajax.BeginForm(new AjaxOptions
            {
                UpdateTargetId = "result",
                InsertionMode = InsertionMode.Replace
            }))
    {
        var pi = NTNS.Utility.PagerInfo.Get("Contact", 10);
       
        <input class="buttonpage" type="submit" value="<< " name="PageNo:0" />
        <input class="buttonpage"  title="Previous" type="submit" value="<" name="PageNo:@(pi.PageNo - 1)" />
        for (var i = pi.PageNo - 3; i < pi.PageNo; i++)
        {
            if (i >= 0)
            {
        <input class="buttonpage"  title="Next" type="submit" value="@i" name="PageNo:@i" />
            }
        }
        <input class="buttonpage pagenaviselect" title="Next" type="submit" value="@pi.PageNo" name="PageNo:@(pi.PageNo)" />
        
        for (var i = pi.PageNo + 1; i < pi.PageNo + 3; i++)
        {
            if (i < pi.PageCount)
            {
        <input class="buttonpage"  title="Next" type="submit" value="@i" name="PageNo:@i" />
            }
        }
        <input class="buttonpage"  title="Next" type="submit" value=">" name="PageNo:@(pi.PageNo + 1)" />
        <input class="buttonpage"  type="submit" value=" >>" name="PageNo:@(pi.LastPageNo)" /> 
    }
</div>
